package com.neusoft.neuiotms.dcom.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
@Table(name = "neuiot_knowledge_type")
@org.hibernate.annotations.Table(appliesTo = "neuiot_knowledge_type", comment = "知识库分类表")
public class KnowledgeType extends AbstractModel {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "分类名称")
    @Length(max = 255, message = "分类名称不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '分类名称'")
    private String name;

    @NotBlank(message = "分类编码")
    @Length(max = 255, message = "分类编码不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '分类名称'")
    private String code;

    @Comment("int(11) NULL COMMENT '排序'")
    private int sort = -1;

    @ManyToOne
    @Comment("bigint(20) NOT NULL COMMENT '父分类 id'")
    private KnowledgeType parent;

}
